package com.caigou.service.impl;

import com.caigou.bean.cms.entity.ArticleLawPrefix;
import com.caigou.mapper.cms.ArticleLawPrefixMapper;
import com.caigou.service.ArticleLawPrefixService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Slf4j
@Service("articleLawPrefixService")
public class ArticleLawPrefixServiceImpl implements ArticleLawPrefixService {

    @Resource
    private ArticleLawPrefixMapper articleLawPrefixMapper;

    @Override
    public void saveArticleLawPrefixData(String articleId, String articleLawPrefixContent) {
        ArticleLawPrefix articleLawPrefix = new ArticleLawPrefix();
        articleLawPrefix.setArticleId(articleId);
        articleLawPrefix.setArticleLawPrefix(articleLawPrefixContent);
        articleLawPrefixMapper.saveArticleLawPrefixData(articleLawPrefix);
    }

    @Override
    public int updateArticleLawPrefixData(String articleId, String articleLawPrefixContent) {
        ArticleLawPrefix articleLawPrefix = new ArticleLawPrefix();
        articleLawPrefix.setArticleId(articleId);
        articleLawPrefix.setArticleLawPrefix(articleLawPrefixContent);
        return articleLawPrefixMapper.updateArticleLawPrefixData(articleLawPrefix);
    }

    @Override
    public int deleteArticleLawPrefixData(String articleId) {
        return articleLawPrefixMapper.deleteArticleLawPrefixData(articleId);
    }

    @Override
    public String loadArticleLawPrefixContent(String articleId) {
        return articleLawPrefixMapper.loadArticleLawPrefixContent(articleId);
    }
}
